<admintpl file="header" />
<style type="text/css">
    .label-normal{
        font-weight: normal;
    }

</style>
</head>
<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a href="{:U('PaymentReview/index')}">工程款支付报审表管理</a></li>
            <!-- <if condition="($Role eq 2) AND ($userrole['role'] eq 5)"> -->
            	
            <!-- </if> -->
            <li><a href="{:U('PaymentReview/add')}">新增工程款支付报审</a></li>
        </ul> 
        
        <table class="table table-hover table-bordered table-striped table-condensed">
            <thead>
                <tr>
                    <th>编号</th>
                    <th style="width: 70px;">流程名称</th>
                    <th>审批发起单位</th>
                    <th>工作内容</th>
                    <th>申请单位</th>
                    <th>申报负责人</th>

                    <th style="width:40px;">总进度</th>
                    <th style="width: 75px;">开始时间</th>
                    <th>阶段截止时间</th>
                    <th>当前审批部门</th>
                    <th style="width:60px;">创建人</th>
                    <th style="width:75px;">创建时间</th>
                    <th width="140">{:L('ACTIONS')}</th>
                </tr>
            </thead>
            <tbody>
            <foreach name="results" item="vo">
                <tr>
                    <td>{$vo.code}</td>
                    <td>{$vo.process_name}</td>
                    <td>{$vo.department_name_first}</td>
                    <td>{$vo.job_content}</td>
                    <td>{$vo.department_name}</td>
                    <td>{$vo.usname}</td>
                    <td class="text-center">
                    	<if condition="$vo['is_publish'] eq 0">
                        	草稿
                        <else />
                            <if condition="$vo['audit_status'] eq 1">
                                审核中 (<php>echo intval($vo['audit_level']) - 1;</php> / <php>echo (intval(($vo['level'] != '' ? $vo['level'] : 0)) + 1) * 2;</php> )<br >
                                <php>
                                    $time = time() - strtotime($vo['add_time']);
                                    $day = intval($time / (24*60*60));
                                    $hour = intval(($time - $day * 24 * 60 * 60) / (60 * 60));
                                    $min = intval(($time - $day * 24 * 60 * 60 - $hour * 60*60) / 60);
                                    if($day >7){
                                        echo ('<span class="label label-danger label-normal">'.$day."天".$hour."小时".$min."分钟".'</span>');
                                    }else{
                                        echo ('<span class="label label-success label-normal">'.$day."天".$hour."小时".$min."分钟".'</span>');
                                    }
                                </php>
                            <elseif  condition="$vo['audit_status'] eq 2" />
                                已驳回
                            <else />
                                已通过
                            </if>
                        </if>
                    </td>
                    <td>
                        {$vo.time}
                    </td>
                    <td>
                    	<if condition="$vo['is_publish'] eq 0">
                        <else />
	                    	{$vo.newtime}<br>
	                        <span <if condition="(time() - strtotime($vo['newtime'])) gt 0">style="background-color:red"</if>>
	                        <if condition="$vo['audit_status'] eq 1">
	                            <php>
	                                $time = time() - strtotime($vo['time']);
	                                $day = intval($time / (24*60*60));
	                                $hour = intval(($time - $day * 24 * 60 * 60) / (60 * 60));
	                                $min = intval(($time - $day * 24 * 60 * 60 - $hour * 60*60) / 60);
	                                
	                                if($day >7){
	                                    echo ('<span class="label label-danger label-normal">'.$day."天".$hour."小时".$min."分钟".'</span>');
	                                }else{
	                                    echo ('<span class="label label-success label-normal">'.$day."天".$hour."小时".$min."分钟".'</span>');
	                                }
	                            </php>
	                        </if>
	                    </if>
                        </span>
                    </td>
                    <td>{$vo.curdept}</td>
					<td>{$vo.real_name}</td>
				    <td>
                        {$vo.add_time}
                    </td>
                    <td class="text-center">
                    	<a href='{:U("PaymentReview/view",array("id"=>$vo["id"]))}'><if condition="$vo['isaudit'] eq 2">查看<else />审核</if></a>
                        <if condition="$vo['is_publish'] eq 0 and $vo['add_user'] eq session('ADMIN_ID')">
                        |
						<a href='{:U("PaymentReview/edit", array("id"=>$vo["id"]))}'>编辑</a>
                        </if>
                        |
						<a href='{:U("PaymentReview/auditHistory", array("id"=>$vo["id"]))}'>审批流程</a>
                        <if condition="session('ADMIN_ID') eq $vo['add_user'] AND $vo['audit_status'] eq 3">
                       	|
                        <a href='{:U("PaymentReview/paynotice", array("id"=>$vo["id"]))}'>开具收款发票通知书</a>
                        </if>

                        <if condition="$role_id eq '0'">
                        |
                        <a class="js-ajax-delete" href="{:U('PaymentReview/delete',array('id'=>$vo['id']))}">删除</a>
                        </if>
                    </td>
                </tr>
            </foreach>
            </tbody>            
        </table>
        <div class="pagination">{$page}</div>
    </div>
    <script src="__PUBLIC__/js/common.js"></script>
</body>
</html>